<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>pytils.test.test_utils</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="pytils-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="pytils-module.html">Package&nbsp;pytils</a> ::
        <a href="pytils.test-module.html">Package&nbsp;test</a> ::
        Module&nbsp;test_utils
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript: void(0);" class="privatelink"
    onclick="toggle_private();">hide private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="pytils.test.test_utils-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="pytils.test.test_utils-module.html">Module pytils.test.test_utils</a></h1>
<pre class="py-src">
<span class="py-lineno">  1</span>  <span class="py-line"><span class="py-comment"># -*- coding: utf-8 -*-</span> </span>
<span class="py-lineno">  2</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment"># License: GNU GPL2</span> </span>
<span class="py-lineno">  3</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment"># Author: Pythy &lt;the.pythy@gmail.com&gt;</span> </span>
<span class="py-lineno">  4</span>  <span class="py-line"><span class="py-comment"></span><span class="py-docstring">"""</span> </span>
<span class="py-lineno">  5</span>  <span class="py-line"><span class="py-docstring">Unit-tests for pytils.utils</span> </span>
<span class="py-lineno">  6</span>  <span class="py-line"><span class="py-docstring">"""</span> </span>
<span class="py-lineno">  7</span>  <span class="py-line"> </span>
<span class="py-lineno">  8</span>  <span class="py-line"><span id="link-0" class="py-name"><a title="pytils.__id__
pytils.dt.__id__
pytils.numeral.__id__
pytils.templatetags.__id__
pytils.templatetags.pytils_dt.__id__
pytils.templatetags.pytils_numeral.__id__
pytils.templatetags.pytils_translit.__id__
pytils.test.__id__
pytils.test.test_dt.__id__
pytils.test.test_numeral.__id__
pytils.test.test_translit.__id__
pytils.test.test_utils.__id__
pytils.translit.__id__
pytils.utils.__id__" class="py-name" href="#" onclick="doclink('link-0', '__id__', 'Variable pytils.__id__=pytils-module.html#__id__,Variable pytils.dt.__id__=pytils.dt-module.html#__id__,Variable pytils.numeral.__id__=pytils.numeral-module.html#__id__,Variable pytils.templatetags.__id__=pytils.templatetags-module.html#__id__,Variable pytils.templatetags.pytils_dt.__id__=pytils.templatetags.pytils_dt-module.html#__id__,Variable pytils.templatetags.pytils_numeral.__id__=pytils.templatetags.pytils_numeral-module.html#__id__,Variable pytils.templatetags.pytils_translit.__id__=pytils.templatetags.pytils_translit-module.html#__id__,Variable pytils.test.__id__=pytils.test-module.html#__id__,Variable pytils.test.test_dt.__id__=pytils.test.test_dt-module.html#__id__,Variable pytils.test.test_numeral.__id__=pytils.test.test_numeral-module.html#__id__,Variable pytils.test.test_translit.__id__=pytils.test.test_translit-module.html#__id__,Variable pytils.test.test_utils.__id__=pytils.test.test_utils-module.html#__id__,Variable pytils.translit.__id__=pytils.translit-module.html#__id__,Variable pytils.utils.__id__=pytils.utils-module.html#__id__'); return false;">__id__</a></span></span> <span class="py-op">=</span> <span id="link-1" class="py-name"><a title="pytils.__revision__
pytils.dt.__revision__
pytils.numeral.__revision__
pytils.templatetags.__revision__
pytils.templatetags.pytils_dt.__revision__
pytils.templatetags.pytils_numeral.__revision__
pytils.templatetags.pytils_translit.__revision__
pytils.test.__revision__
pytils.test.test_dt.__revision__
pytils.test.test_numeral.__revision__
pytils.test.test_translit.__revision__
pytils.test.test_utils.__revision__
pytils.translit.__revision__
pytils.utils.__revision__" class="py-name" href="#" onclick="doclink('link-1', '__revision__', 'Variable pytils.__revision__=pytils-module.html#__revision__,Variable pytils.dt.__revision__=pytils.dt-module.html#__revision__,Variable pytils.numeral.__revision__=pytils.numeral-module.html#__revision__,Variable pytils.templatetags.__revision__=pytils.templatetags-module.html#__revision__,Variable pytils.templatetags.pytils_dt.__revision__=pytils.templatetags.pytils_dt-module.html#__revision__,Variable pytils.templatetags.pytils_numeral.__revision__=pytils.templatetags.pytils_numeral-module.html#__revision__,Variable pytils.templatetags.pytils_translit.__revision__=pytils.templatetags.pytils_translit-module.html#__revision__,Variable pytils.test.__revision__=pytils.test-module.html#__revision__,Variable pytils.test.test_dt.__revision__=pytils.test.test_dt-module.html#__revision__,Variable pytils.test.test_numeral.__revision__=pytils.test.test_numeral-module.html#__revision__,Variable pytils.test.test_translit.__revision__=pytils.test.test_translit-module.html#__revision__,Variable pytils.test.test_utils.__revision__=pytils.test.test_utils-module.html#__revision__,Variable pytils.translit.__revision__=pytils.translit-module.html#__revision__,Variable pytils.utils.__revision__=pytils.utils-module.html#__revision__'); return false;">__revision__</a></span></span> <span class="py-op">=</span> <span class="py-string">"$Id: test_utils.py 18 2006-10-17 15:58:01Z the.pythy $"</span> </span>
<span class="py-lineno">  9</span>  <span class="py-line"><span id="link-2" class="py-name"><a title="pytils.__url__
pytils.dt.__url__
pytils.numeral.__url__
pytils.templatetags.__url__
pytils.templatetags.pytils_dt.__url__
pytils.templatetags.pytils_numeral.__url__
pytils.templatetags.pytils_translit.__url__
pytils.test.__url__
pytils.test.test_dt.__url__
pytils.test.test_numeral.__url__
pytils.test.test_translit.__url__
pytils.test.test_utils.__url__
pytils.translit.__url__
pytils.utils.__url__" class="py-name" href="#" onclick="doclink('link-2', '__url__', 'Variable pytils.__url__=pytils-module.html#__url__,Variable pytils.dt.__url__=pytils.dt-module.html#__url__,Variable pytils.numeral.__url__=pytils.numeral-module.html#__url__,Variable pytils.templatetags.__url__=pytils.templatetags-module.html#__url__,Variable pytils.templatetags.pytils_dt.__url__=pytils.templatetags.pytils_dt-module.html#__url__,Variable pytils.templatetags.pytils_numeral.__url__=pytils.templatetags.pytils_numeral-module.html#__url__,Variable pytils.templatetags.pytils_translit.__url__=pytils.templatetags.pytils_translit-module.html#__url__,Variable pytils.test.__url__=pytils.test-module.html#__url__,Variable pytils.test.test_dt.__url__=pytils.test.test_dt-module.html#__url__,Variable pytils.test.test_numeral.__url__=pytils.test.test_numeral-module.html#__url__,Variable pytils.test.test_translit.__url__=pytils.test.test_translit-module.html#__url__,Variable pytils.test.test_utils.__url__=pytils.test.test_utils-module.html#__url__,Variable pytils.translit.__url__=pytils.translit-module.html#__url__,Variable pytils.utils.__url__=pytils.utils-module.html#__url__'); return false;">__url__</a></span></span> <span class="py-op">=</span> <span class="py-string">"$URL: https://pythy.googlecode.com/svn/trunk/pytils/pytils/test/test_utils.py $"</span> </span>
<span class="py-lineno"> 10</span>  <span class="py-line"> </span>
<span class="py-lineno"> 11</span>  <span class="py-line"><span class="py-keyword">import</span> <span class="py-name">unittest</span> </span>
<span class="py-lineno"> 12</span>  <span class="py-line"><span class="py-keyword">import</span> <span id="link-3" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-3', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span>  </span>
<span class="py-lineno"> 13</span>  <span class="py-line"> </span>
<a name="UnicodeTestCase"></a><div id="UnicodeTestCase-def"><span class="py-lineno"> 14</span> <a class="py-toggle" href="#" id="UnicodeTestCase-toggle" onclick="toggle('UnicodeTestCase'); return false;">-</a><span class="py-line"><span class="py-keyword">class</span> <a class="py-def-name" href="pytils.test.test_utils.UnicodeTestCase-class.html">UnicodeTestCase</a><span class="py-op">(</span><span class="py-base-class">unittest</span><span class="py-op">.</span><span class="py-base-class">TestCase</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="UnicodeTestCase-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="UnicodeTestCase-expanded"><span class="py-lineno"> 15</span>  <span class="py-line">    <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 16</span>  <span class="py-line"><span class="py-docstring">    Test case for unicode-utils </span> </span>
<span class="py-lineno"> 17</span>  <span class="py-line"><span class="py-docstring">    """</span> </span>
<span class="py-lineno"> 18</span>  <span class="py-line"> </span>
<a name="UnicodeTestCase.ckProvideUnicode"></a><div id="UnicodeTestCase.ckProvideUnicode-def"><span class="py-lineno"> 19</span> <a class="py-toggle" href="#" id="UnicodeTestCase.ckProvideUnicode-toggle" onclick="toggle('UnicodeTestCase.ckProvideUnicode'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.UnicodeTestCase-class.html#ckProvideUnicode">ckProvideUnicode</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">stext</span><span class="py-op">,</span> <span class="py-param">encoding</span><span class="py-op">,</span> <span class="py-param">utext</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="UnicodeTestCase.ckProvideUnicode-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="UnicodeTestCase.ckProvideUnicode-expanded"><span class="py-lineno"> 20</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 21</span>  <span class="py-line"><span class="py-docstring">        Check pytils.provide_unicode</span> </span>
<span class="py-lineno"> 22</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno"> 23</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span> </span>
<span class="py-lineno"> 24</span>  <span class="py-line">            <span id="link-4" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-4', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-5" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-5', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-6" class="py-name"><a title="pytils.utils.provide_unicode" class="py-name" href="#" onclick="doclink('link-6', 'provide_unicode', 'Function pytils.utils.provide_unicode()=pytils.utils-module.html#provide_unicode'); return false;">provide_unicode</a></span></span><span class="py-op">(</span><span class="py-name">stext</span><span class="py-op">,</span> <span id="link-7" class="py-name"><a title="pytils.templatetags.pytils_dt.encoding
pytils.templatetags.pytils_numeral.encoding
pytils.templatetags.pytils_translit.encoding" class="py-name" href="#" onclick="doclink('link-7', 'encoding', 'Variable pytils.templatetags.pytils_dt.encoding=pytils.templatetags.pytils_dt-module.html#encoding,Variable pytils.templatetags.pytils_numeral.encoding=pytils.templatetags.pytils_numeral-module.html#encoding,Variable pytils.templatetags.pytils_translit.encoding=pytils.templatetags.pytils_translit-module.html#encoding'); return false;">encoding</a></span></span><span class="py-op">)</span><span class="py-op">,</span> </span>
<span class="py-lineno"> 25</span>  <span class="py-line">            <span class="py-name">utext</span> </span>
<span class="py-lineno"> 26</span>  <span class="py-line">            <span class="py-op">)</span> </span>
</div><span class="py-lineno"> 27</span>  <span class="py-line"> </span>
<a name="UnicodeTestCase.ckProvideStr"></a><div id="UnicodeTestCase.ckProvideStr-def"><span class="py-lineno"> 28</span> <a class="py-toggle" href="#" id="UnicodeTestCase.ckProvideStr-toggle" onclick="toggle('UnicodeTestCase.ckProvideStr'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.UnicodeTestCase-class.html#ckProvideStr">ckProvideStr</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">utext</span><span class="py-op">,</span> <span class="py-param">encoding</span><span class="py-op">,</span> <span class="py-param">stext</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="UnicodeTestCase.ckProvideStr-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="UnicodeTestCase.ckProvideStr-expanded"><span class="py-lineno"> 29</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 30</span>  <span class="py-line"><span class="py-docstring">        Check pytils.provide_str</span> </span>
<span class="py-lineno"> 31</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno"> 32</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span> </span>
<span class="py-lineno"> 33</span>  <span class="py-line">            <span id="link-8" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-8', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-9" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-9', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-10" class="py-name"><a title="pytils.utils.provide_str" class="py-name" href="#" onclick="doclink('link-10', 'provide_str', 'Function pytils.utils.provide_str()=pytils.utils-module.html#provide_str'); return false;">provide_str</a></span></span><span class="py-op">(</span><span class="py-name">utext</span><span class="py-op">,</span> <span id="link-11" class="py-name"><a title="pytils.templatetags.pytils_dt.encoding
pytils.templatetags.pytils_numeral.encoding
pytils.templatetags.pytils_translit.encoding" class="py-name" href="#" onclick="doclink('link-11', 'encoding', 'Variable pytils.templatetags.pytils_dt.encoding=pytils.templatetags.pytils_dt-module.html#encoding,Variable pytils.templatetags.pytils_numeral.encoding=pytils.templatetags.pytils_numeral-module.html#encoding,Variable pytils.templatetags.pytils_translit.encoding=pytils.templatetags.pytils_translit-module.html#encoding'); return false;">encoding</a></span></span><span class="py-op">)</span><span class="py-op">,</span> </span>
<span class="py-lineno"> 34</span>  <span class="py-line">            <span class="py-name">stext</span> </span>
<span class="py-lineno"> 35</span>  <span class="py-line">            <span class="py-op">)</span> </span>
</div><span class="py-lineno"> 36</span>  <span class="py-line"> </span>
<a name="UnicodeTestCase.testProvideUnicode"></a><div id="UnicodeTestCase.testProvideUnicode-def"><span class="py-lineno"> 37</span> <a class="py-toggle" href="#" id="UnicodeTestCase.testProvideUnicode-toggle" onclick="toggle('UnicodeTestCase.testProvideUnicode'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.UnicodeTestCase-class.html#testProvideUnicode">testProvideUnicode</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="UnicodeTestCase.testProvideUnicode-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="UnicodeTestCase.testProvideUnicode-expanded"><span class="py-lineno"> 38</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 39</span>  <span class="py-line"><span class="py-docstring">        Unit-tests for pytils.utils.provide_unicode</span> </span>
<span class="py-lineno"> 40</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno"> 41</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span id="link-12" class="py-name"><a title="pytils.test.test_utils.UnicodeTestCase.ckProvideUnicode" class="py-name" href="#" onclick="doclink('link-12', 'ckProvideUnicode', 'Method pytils.test.test_utils.UnicodeTestCase.ckProvideUnicode()=pytils.test.test_utils.UnicodeTestCase-class.html#ckProvideUnicode'); return false;">ckProvideUnicode</a></span></span><span class="py-op">(</span><span class="py-string">"&#1090;&#1077;&#1089;&#1090; &#8470;1"</span><span class="py-op">,</span> <span class="py-string">"utf-8"</span><span class="py-op">,</span> <span class="py-string">u"&#1090;&#1077;&#1089;&#1090; &#8470;1"</span><span class="py-op">)</span> </span>
</div><span class="py-lineno"> 42</span>  <span class="py-line"> </span>
<a name="UnicodeTestCase.testProvideStr"></a><div id="UnicodeTestCase.testProvideStr-def"><span class="py-lineno"> 43</span> <a class="py-toggle" href="#" id="UnicodeTestCase.testProvideStr-toggle" onclick="toggle('UnicodeTestCase.testProvideStr'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.UnicodeTestCase-class.html#testProvideStr">testProvideStr</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="UnicodeTestCase.testProvideStr-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="UnicodeTestCase.testProvideStr-expanded"><span class="py-lineno"> 44</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 45</span>  <span class="py-line"><span class="py-docstring">        Unit-tests for pytils.utils.provide_str</span> </span>
<span class="py-lineno"> 46</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno"> 47</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span id="link-13" class="py-name"><a title="pytils.test.test_utils.UnicodeTestCase.ckProvideStr" class="py-name" href="#" onclick="doclink('link-13', 'ckProvideStr', 'Method pytils.test.test_utils.UnicodeTestCase.ckProvideStr()=pytils.test.test_utils.UnicodeTestCase-class.html#ckProvideStr'); return false;">ckProvideStr</a></span></span><span class="py-op">(</span><span class="py-string">u"&#1090;&#1077;&#1089;&#1090; &#8470;1"</span><span class="py-op">,</span> <span class="py-string">"utf-8"</span><span class="py-op">,</span> <span class="py-string">"&#1090;&#1077;&#1089;&#1090; &#8470;1"</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 48</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span id="link-14" class="py-name"><a title="pytils.test.test_utils.UnicodeTestCase.ckProvideStr" class="py-name" href="#" onclick="doclink('link-14', 'ckProvideStr', 'Method pytils.test.test_utils.UnicodeTestCase.ckProvideStr()=pytils.test.test_utils.UnicodeTestCase-class.html#ckProvideStr'); return false;">ckProvideStr</a></span></span><span class="py-op">(</span><span class="py-string">u"&#1090;&#1077;&#1089;&#1090; &#8470;1"</span><span class="py-op">,</span> <span class="py-string">"koi8-r"</span><span class="py-op">,</span> <span class="py-string">"unknown"</span><span class="py-op">)</span> </span>
</div><span class="py-lineno"> 49</span>  <span class="py-line"> </span>
<a name="UnicodeTestCase.testProvideStrNonDefault"></a><div id="UnicodeTestCase.testProvideStrNonDefault-def"><span class="py-lineno"> 50</span> <a class="py-toggle" href="#" id="UnicodeTestCase.testProvideStrNonDefault-toggle" onclick="toggle('UnicodeTestCase.testProvideStrNonDefault'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.UnicodeTestCase-class.html#testProvideStrNonDefault">testProvideStrNonDefault</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="UnicodeTestCase.testProvideStrNonDefault-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="UnicodeTestCase.testProvideStrNonDefault-expanded"><span class="py-lineno"> 51</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 52</span>  <span class="py-line"><span class="py-docstring">        Unit-tests for pytils.utils.provide_str with 'default' parameter</span> </span>
<span class="py-lineno"> 53</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno"> 54</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span> </span>
<span class="py-lineno"> 55</span>  <span class="py-line">            <span id="link-15" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-15', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-16" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-16', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-17" class="py-name"><a title="pytils.utils.provide_str" class="py-name" href="#" onclick="doclink('link-17', 'provide_str', 'Function pytils.utils.provide_str()=pytils.utils-module.html#provide_str'); return false;">provide_str</a></span></span><span class="py-op">(</span><span class="py-string">u"&#1090;&#1077;&#1089;&#1090; &#8470;1"</span><span class="py-op">,</span> <span class="py-string">"koi8-r"</span><span class="py-op">,</span> <span class="py-name">default</span><span class="py-op">=</span><span class="py-string">"hz"</span><span class="py-op">)</span><span class="py-op">,</span> </span>
<span class="py-lineno"> 56</span>  <span class="py-line">            <span class="py-string">"hz"</span> </span>
<span class="py-lineno"> 57</span>  <span class="py-line">            <span class="py-op">)</span> </span>
</div></div><span class="py-lineno"> 58</span>  <span class="py-line"> </span>
<a name="ChecksTestCase"></a><div id="ChecksTestCase-def"><span class="py-lineno"> 59</span> <a class="py-toggle" href="#" id="ChecksTestCase-toggle" onclick="toggle('ChecksTestCase'); return false;">-</a><span class="py-line"><span class="py-keyword">class</span> <a class="py-def-name" href="pytils.test.test_utils.ChecksTestCase-class.html">ChecksTestCase</a><span class="py-op">(</span><span class="py-base-class">unittest</span><span class="py-op">.</span><span class="py-base-class">TestCase</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="ChecksTestCase-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ChecksTestCase-expanded"><span class="py-lineno"> 60</span>  <span class="py-line">    <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 61</span>  <span class="py-line"><span class="py-docstring">    Test case for check_* utils</span> </span>
<span class="py-lineno"> 62</span>  <span class="py-line"><span class="py-docstring">    """</span> </span>
<span class="py-lineno"> 63</span>  <span class="py-line"> </span>
<a name="ChecksTestCase.testGetValueByName"></a><div id="ChecksTestCase.testGetValueByName-def"><span class="py-lineno"> 64</span> <a class="py-toggle" href="#" id="ChecksTestCase.testGetValueByName-toggle" onclick="toggle('ChecksTestCase.testGetValueByName'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.ChecksTestCase-class.html#testGetValueByName">testGetValueByName</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="ChecksTestCase.testGetValueByName-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ChecksTestCase.testGetValueByName-expanded"><span class="py-lineno"> 65</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 66</span>  <span class="py-line"><span class="py-docstring">        Unit-test for pytils.utils.get_value_by_name</span> </span>
<span class="py-lineno"> 67</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno"> 68</span>  <span class="py-line">        <span class="py-name">var1</span> <span class="py-op">=</span> <span class="py-string">'25'</span> </span>
<span class="py-lineno"> 69</span>  <span class="py-line">        <span class="py-name">var2</span> <span class="py-op">=</span> <span class="py-number">25</span> </span>
<span class="py-lineno"> 70</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">'25'</span><span class="py-op">,</span> <span id="link-18" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-18', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-19" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-19', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-20" class="py-name"><a title="pytils.utils.get_value_by_name" class="py-name" href="#" onclick="doclink('link-20', 'get_value_by_name', 'Function pytils.utils.get_value_by_name()=pytils.utils-module.html#get_value_by_name'); return false;">get_value_by_name</a></span></span><span class="py-op">(</span><span class="py-string">'var1'</span><span class="py-op">,</span> <span class="py-name">depth</span><span class="py-op">=</span><span class="py-number">1</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 71</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-number">25</span><span class="py-op">,</span> <span id="link-21" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-21', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-22" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-22', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-23" class="py-name"><a title="pytils.utils.get_value_by_name" class="py-name" href="#" onclick="doclink('link-23', 'get_value_by_name', 'Function pytils.utils.get_value_by_name()=pytils.utils-module.html#get_value_by_name'); return false;">get_value_by_name</a></span></span><span class="py-op">(</span><span class="py-string">'var2'</span><span class="py-op">,</span> <span class="py-name">depth</span><span class="py-op">=</span><span class="py-number">1</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 72</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertRaises</span><span class="py-op">(</span><span class="py-name">RuntimeError</span><span class="py-op">,</span> <span id="link-24" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-24', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-25" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-25', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-26" class="py-name"><a title="pytils.utils.get_value_by_name" class="py-name" href="#" onclick="doclink('link-26', 'get_value_by_name', 'Function pytils.utils.get_value_by_name()=pytils.utils-module.html#get_value_by_name'); return false;">get_value_by_name</a></span></span><span class="py-op">,</span> <span class="py-string">'var3'</span><span class="py-op">)</span> </span>
</div><span class="py-lineno"> 73</span>  <span class="py-line">         </span>
<span class="py-lineno"> 74</span>  <span class="py-line"> </span>
<a name="ChecksTestCase.testCheckType"></a><div id="ChecksTestCase.testCheckType-def"><span class="py-lineno"> 75</span> <a class="py-toggle" href="#" id="ChecksTestCase.testCheckType-toggle" onclick="toggle('ChecksTestCase.testCheckType'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.ChecksTestCase-class.html#testCheckType">testCheckType</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="ChecksTestCase.testCheckType-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ChecksTestCase.testCheckType-expanded"><span class="py-lineno"> 76</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 77</span>  <span class="py-line"><span class="py-docstring">        Unit-test for pytils.utils.check_type</span> </span>
<span class="py-lineno"> 78</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno"> 79</span>  <span class="py-line">        <span class="py-name">var</span> <span class="py-op">=</span> <span class="py-string">'25'</span> </span>
<span class="py-lineno"> 80</span>  <span class="py-line">        <span class="py-comment"># &#1085;&#1077;&#1083;&#1100;&#1079;&#1103; assertRaises, &#1087;&#1086;&#1090;&#1086;&#1084;&#1091; &#1095;&#1090;&#1086; &#1075;&#1083;&#1091;&#1073;&#1080;&#1085;&#1072; &#1089;&#1090;&#1077;&#1082;&#1072; &#1074;&#1099;&#1079;&#1086;&#1074;&#1086;&#1074; &#1090;&#1086;&#1075;&#1076;&#1072; &#1085;&#1077; 2,</span> </span>
<span class="py-lineno"> 81</span>  <span class="py-line"><span class="py-comment"></span>        <span class="py-comment"># &#1072; &#1075;&#1086;&#1088;&#1072;&#1079;&#1076;&#1086; &#1073;&#1086;&#1083;&#1100;&#1096;&#1077;</span> </span>
<span class="py-lineno"> 82</span>  <span class="py-line"><span class="py-comment"></span>        <span class="py-keyword">try</span><span class="py-op">:</span> </span>
<span class="py-lineno"> 83</span>  <span class="py-line">            <span id="link-27" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-27', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-28" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-28', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-29" class="py-name"><a title="pytils.utils.check_type" class="py-name" href="#" onclick="doclink('link-29', 'check_type', 'Function pytils.utils.check_type()=pytils.utils-module.html#check_type'); return false;">check_type</a></span></span><span class="py-op">(</span><span class="py-string">'var'</span><span class="py-op">,</span> <span class="py-name">int</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 84</span>  <span class="py-line">        <span class="py-keyword">except</span> <span class="py-name">TypeError</span><span class="py-op">,</span> <span class="py-name">err</span><span class="py-op">:</span> </span>
<span class="py-lineno"> 85</span>  <span class="py-line">            <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">"var must be &lt;type 'int'&gt;, not &lt;type 'str'&gt;"</span><span class="py-op">,</span> </span>
<span class="py-lineno"> 86</span>  <span class="py-line">                              <span class="py-name">str</span><span class="py-op">(</span><span class="py-name">err</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 87</span>  <span class="py-line">        <span class="py-keyword">try</span><span class="py-op">:</span> </span>
<span class="py-lineno"> 88</span>  <span class="py-line">            <span id="link-30" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-30', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-31" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-31', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-32" class="py-name"><a title="pytils.utils.check_type" class="py-name" href="#" onclick="doclink('link-32', 'check_type', 'Function pytils.utils.check_type()=pytils.utils-module.html#check_type'); return false;">check_type</a></span></span><span class="py-op">(</span><span class="py-string">'var'</span><span class="py-op">,</span> <span class="py-op">(</span><span class="py-name">int</span><span class="py-op">,</span> <span class="py-name">float</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 89</span>  <span class="py-line">        <span class="py-keyword">except</span> <span class="py-name">TypeError</span><span class="py-op">,</span> <span class="py-name">err</span><span class="py-op">:</span> </span>
<span class="py-lineno"> 90</span>  <span class="py-line">            <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">"var must be (&lt;type 'int'&gt;, &lt;type 'float'&gt;), "</span> <span class="py-op">+</span> \ </span>
<span class="py-lineno"> 91</span>  <span class="py-line">                              <span class="py-string">"not &lt;type 'str'&gt;"</span><span class="py-op">,</span> </span>
<span class="py-lineno"> 92</span>  <span class="py-line">                              <span class="py-name">str</span><span class="py-op">(</span><span class="py-name">err</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 93</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">,</span> <span id="link-33" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-33', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-34" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-34', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-35" class="py-name"><a title="pytils.utils.check_type" class="py-name" href="#" onclick="doclink('link-35', 'check_type', 'Function pytils.utils.check_type()=pytils.utils-module.html#check_type'); return false;">check_type</a></span></span><span class="py-op">(</span><span class="py-string">'var'</span><span class="py-op">,</span> <span class="py-name">str</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 94</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">,</span> <span id="link-36" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-36', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-37" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-37', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-38" class="py-name"><a title="pytils.utils.check_type" class="py-name" href="#" onclick="doclink('link-38', 'check_type', 'Function pytils.utils.check_type()=pytils.utils-module.html#check_type'); return false;">check_type</a></span></span><span class="py-op">(</span><span class="py-string">'var'</span><span class="py-op">,</span> </span>
<span class="py-lineno"> 95</span>  <span class="py-line">                                                        <span class="py-op">(</span><span class="py-name">str</span><span class="py-op">,</span> <span class="py-name">basestring</span><span class="py-op">)</span><span class="py-op">)</span><span class="py-op">)</span> </span>
</div><span class="py-lineno"> 96</span>  <span class="py-line"> </span>
<a name="ChecksTestCase.testCheckLength"></a><div id="ChecksTestCase.testCheckLength-def"><span class="py-lineno"> 97</span> <a class="py-toggle" href="#" id="ChecksTestCase.testCheckLength-toggle" onclick="toggle('ChecksTestCase.testCheckLength'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.ChecksTestCase-class.html#testCheckLength">testCheckLength</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="ChecksTestCase.testCheckLength-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ChecksTestCase.testCheckLength-expanded"><span class="py-lineno"> 98</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno"> 99</span>  <span class="py-line"><span class="py-docstring">        Unit-test for pytils.utils.check_length</span> </span>
<span class="py-lineno">100</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno">101</span>  <span class="py-line">        <span class="py-name">var</span> <span class="py-op">=</span> <span class="py-string">'test'</span> </span>
<span class="py-lineno">102</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">,</span> <span id="link-39" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-39', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-40" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-40', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-41" class="py-name"><a title="pytils.utils.check_length" class="py-name" href="#" onclick="doclink('link-41', 'check_length', 'Function pytils.utils.check_length()=pytils.utils-module.html#check_length'); return false;">check_length</a></span></span><span class="py-op">(</span><span class="py-string">'var'</span><span class="py-op">,</span> <span class="py-number">4</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno">103</span>  <span class="py-line">        <span class="py-keyword">try</span><span class="py-op">:</span> </span>
<span class="py-lineno">104</span>  <span class="py-line">            <span id="link-42" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-42', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-43" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-43', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-44" class="py-name"><a title="pytils.utils.check_length" class="py-name" href="#" onclick="doclink('link-44', 'check_length', 'Function pytils.utils.check_length()=pytils.utils-module.html#check_length'); return false;">check_length</a></span></span><span class="py-op">(</span><span class="py-string">'var'</span><span class="py-op">,</span> <span class="py-number">5</span><span class="py-op">)</span> </span>
<span class="py-lineno">105</span>  <span class="py-line">        <span class="py-keyword">except</span> <span class="py-name">ValueError</span><span class="py-op">,</span> <span class="py-name">err</span><span class="py-op">:</span> </span>
<span class="py-lineno">106</span>  <span class="py-line">            <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">"var's length must be 5, but it 4"</span><span class="py-op">,</span> </span>
<span class="py-lineno">107</span>  <span class="py-line">                              <span class="py-name">str</span><span class="py-op">(</span><span class="py-name">err</span><span class="py-op">)</span><span class="py-op">)</span> </span>
</div><span class="py-lineno">108</span>  <span class="py-line"> </span>
<a name="ChecksTestCase.testCheckPositive"></a><div id="ChecksTestCase.testCheckPositive-def"><span class="py-lineno">109</span> <a class="py-toggle" href="#" id="ChecksTestCase.testCheckPositive-toggle" onclick="toggle('ChecksTestCase.testCheckPositive'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.ChecksTestCase-class.html#testCheckPositive">testCheckPositive</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="ChecksTestCase.testCheckPositive-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ChecksTestCase.testCheckPositive-expanded"><span class="py-lineno">110</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno">111</span>  <span class="py-line"><span class="py-docstring">        Unit-test for pytils.utils.check_positive</span> </span>
<span class="py-lineno">112</span>  <span class="py-line"><span class="py-docstring">        """</span> </span>
<span class="py-lineno">113</span>  <span class="py-line">        <span class="py-name">var1</span> <span class="py-op">=</span> <span class="py-number">1</span> </span>
<span class="py-lineno">114</span>  <span class="py-line">        <span class="py-name">var2</span> <span class="py-op">=</span> <span class="py-number">1.25</span> </span>
<span class="py-lineno">115</span>  <span class="py-line">        <span class="py-name">var3</span> <span class="py-op">=</span> <span class="py-op">-</span><span class="py-number">2</span> </span>
<span class="py-lineno">116</span>  <span class="py-line">        <span class="py-name">var4</span> <span class="py-op">=</span> <span class="py-op">-</span><span class="py-number">2.12</span> </span>
<span class="py-lineno">117</span>  <span class="py-line"> </span>
<span class="py-lineno">118</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">,</span> <span id="link-45" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-45', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-46" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-46', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-47" class="py-name"><a title="pytils.utils.check_positive" class="py-name" href="#" onclick="doclink('link-47', 'check_positive', 'Function pytils.utils.check_positive()=pytils.utils-module.html#check_positive'); return false;">check_positive</a></span></span><span class="py-op">(</span><span class="py-string">'var1'</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno">119</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">,</span> <span id="link-48" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-48', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-49" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-49', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-50" class="py-name"><a title="pytils.utils.check_positive" class="py-name" href="#" onclick="doclink('link-50', 'check_positive', 'Function pytils.utils.check_positive()=pytils.utils-module.html#check_positive'); return false;">check_positive</a></span></span><span class="py-op">(</span><span class="py-string">'var2'</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno">120</span>  <span class="py-line"> </span>
<span class="py-lineno">121</span>  <span class="py-line">        <span class="py-keyword">try</span><span class="py-op">:</span> </span>
<span class="py-lineno">122</span>  <span class="py-line">            <span id="link-51" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-51', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-52" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-52', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-53" class="py-name"><a title="pytils.utils.check_positive" class="py-name" href="#" onclick="doclink('link-53', 'check_positive', 'Function pytils.utils.check_positive()=pytils.utils-module.html#check_positive'); return false;">check_positive</a></span></span><span class="py-op">(</span><span class="py-string">'var3'</span><span class="py-op">)</span> </span>
<span class="py-lineno">123</span>  <span class="py-line">        <span class="py-keyword">except</span> <span class="py-name">ValueError</span><span class="py-op">,</span> <span class="py-name">err</span><span class="py-op">:</span> </span>
<span class="py-lineno">124</span>  <span class="py-line">            <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">"var3 must be positive or zero, not -2"</span><span class="py-op">,</span> </span>
<span class="py-lineno">125</span>  <span class="py-line">                              <span class="py-name">str</span><span class="py-op">(</span><span class="py-name">err</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno">126</span>  <span class="py-line">        <span class="py-keyword">try</span><span class="py-op">:</span> </span>
<span class="py-lineno">127</span>  <span class="py-line">            <span id="link-54" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-54', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-55" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-55', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-56" class="py-name"><a title="pytils.utils.check_positive" class="py-name" href="#" onclick="doclink('link-56', 'check_positive', 'Function pytils.utils.check_positive()=pytils.utils-module.html#check_positive'); return false;">check_positive</a></span></span><span class="py-op">(</span><span class="py-string">'var4'</span><span class="py-op">)</span> </span>
<span class="py-lineno">128</span>  <span class="py-line">        <span class="py-keyword">except</span> <span class="py-name">ValueError</span><span class="py-op">,</span> <span class="py-name">err</span><span class="py-op">:</span> </span>
<span class="py-lineno">129</span>  <span class="py-line">            <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">"var4 must be positive or zero, not -2.12"</span><span class="py-op">,</span> </span>
<span class="py-lineno">130</span>  <span class="py-line">                              <span class="py-name">str</span><span class="py-op">(</span><span class="py-name">err</span><span class="py-op">)</span><span class="py-op">)</span> </span>
</div><span class="py-lineno">131</span>  <span class="py-line"> </span>
<a name="ChecksTestCase.testCheckPositiveStrict"></a><div id="ChecksTestCase.testCheckPositiveStrict-def"><span class="py-lineno">132</span> <a class="py-toggle" href="#" id="ChecksTestCase.testCheckPositiveStrict-toggle" onclick="toggle('ChecksTestCase.testCheckPositiveStrict'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="pytils.test.test_utils.ChecksTestCase-class.html#testCheckPositiveStrict">testCheckPositiveStrict</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="ChecksTestCase.testCheckPositiveStrict-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ChecksTestCase.testCheckPositiveStrict-expanded"><span class="py-lineno">133</span>  <span class="py-line">        <span class="py-docstring">"""</span> </span>
<span class="py-lineno">134</span>  <span class="py-line"><span class="py-docstring">        Unit-test for pytils.utils.check_positive</span> </span>
<span class="py-lineno">135</span>  <span class="py-line"><span class="py-docstring">        """</span>         </span>
<span class="py-lineno">136</span>  <span class="py-line">        <span class="py-name">var1</span> <span class="py-op">=</span> <span class="py-number">1</span> </span>
<span class="py-lineno">137</span>  <span class="py-line">        <span class="py-name">var2</span> <span class="py-op">=</span> <span class="py-number">0</span> </span>
<span class="py-lineno">138</span>  <span class="py-line">        <span class="py-name">var3</span> <span class="py-op">=</span> <span class="py-op">-</span><span class="py-number">2</span> </span>
<span class="py-lineno">139</span>  <span class="py-line"> </span>
<span class="py-lineno">140</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">,</span> <span id="link-57" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-57', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-58" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-58', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-59" class="py-name"><a title="pytils.utils.check_positive" class="py-name" href="#" onclick="doclink('link-59', 'check_positive', 'Function pytils.utils.check_positive()=pytils.utils-module.html#check_positive'); return false;">check_positive</a></span></span><span class="py-op">(</span><span class="py-string">'var1'</span><span class="py-op">,</span> <span class="py-name">strict</span><span class="py-op">=</span><span class="py-name">True</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno">141</span>  <span class="py-line"> </span>
<span class="py-lineno">142</span>  <span class="py-line">        <span class="py-keyword">try</span><span class="py-op">:</span> </span>
<span class="py-lineno">143</span>  <span class="py-line">            <span id="link-60" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-60', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-61" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-61', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-62" class="py-name"><a title="pytils.utils.check_positive" class="py-name" href="#" onclick="doclink('link-62', 'check_positive', 'Function pytils.utils.check_positive()=pytils.utils-module.html#check_positive'); return false;">check_positive</a></span></span><span class="py-op">(</span><span class="py-string">'var2'</span><span class="py-op">,</span> <span class="py-name">strict</span><span class="py-op">=</span><span class="py-name">True</span><span class="py-op">)</span> </span>
<span class="py-lineno">144</span>  <span class="py-line">        <span class="py-keyword">except</span> <span class="py-name">ValueError</span><span class="py-op">,</span> <span class="py-name">err</span><span class="py-op">:</span> </span>
<span class="py-lineno">145</span>  <span class="py-line">            <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">"var2 must be positive, not 0"</span><span class="py-op">,</span> </span>
<span class="py-lineno">146</span>  <span class="py-line">                              <span class="py-name">str</span><span class="py-op">(</span><span class="py-name">err</span><span class="py-op">)</span><span class="py-op">)</span> </span>
<span class="py-lineno">147</span>  <span class="py-line">        <span class="py-keyword">try</span><span class="py-op">:</span> </span>
<span class="py-lineno">148</span>  <span class="py-line">            <span id="link-63" class="py-name"><a title="pytils" class="py-name" href="#" onclick="doclink('link-63', 'pytils', 'Package pytils=pytils-module.html'); return false;">pytils</a></span></span><span class="py-op">.</span><span id="link-64" class="py-name"><a title="pytils.utils" class="py-name" href="#" onclick="doclink('link-64', 'utils', 'Module pytils.utils=pytils.utils-module.html'); return false;">utils</a></span></span><span class="py-op">.</span><span id="link-65" class="py-name"><a title="pytils.utils.check_positive" class="py-name" href="#" onclick="doclink('link-65', 'check_positive', 'Function pytils.utils.check_positive()=pytils.utils-module.html#check_positive'); return false;">check_positive</a></span></span><span class="py-op">(</span><span class="py-string">'var3'</span><span class="py-op">)</span> </span>
<span class="py-lineno">149</span>  <span class="py-line">        <span class="py-keyword">except</span> <span class="py-name">ValueError</span><span class="py-op">,</span> <span class="py-name">err</span><span class="py-op">:</span> </span>
<span class="py-lineno">150</span>  <span class="py-line">            <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">assertEquals</span><span class="py-op">(</span><span class="py-string">"var3 must be positive or zero, not -2"</span><span class="py-op">,</span> </span>
<span class="py-lineno">151</span>  <span class="py-line">                              <span class="py-name">str</span><span class="py-op">(</span><span class="py-name">err</span><span class="py-op">)</span><span class="py-op">)</span> </span>
</div></div><span class="py-lineno">152</span>  <span class="py-line"> </span>
<span class="py-lineno">153</span>  <span class="py-line"> </span>
<span class="py-lineno">154</span>  <span class="py-line"><span class="py-keyword">if</span> <span class="py-name">__name__</span> <span class="py-op">==</span> <span class="py-string">'__main__'</span><span class="py-op">:</span> </span>
<span class="py-lineno">155</span>  <span class="py-line">    <span class="py-name">unittest</span><span class="py-op">.</span><span class="py-name">main</span><span class="py-op">(</span><span class="py-op">)</span> </span>
<span class="py-lineno">156</span>  <span class="py-line"> </span><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="pytils-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">Generated by Epydoc
        3.0alpha3 on Sun Oct 29 00:35:03 2006</td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
